package auto.app.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum DatabaseConnectType {
    INSERT("insert","INSERT"),
    UPDATE("update","UPDATE"),
    SELECT("select","SELECT"),
    DELETE("delete","DELETE")
    ;
    private String databaseConnectionType;
    private String databaseConnectionMsg;

    public String getDatabaseConnectionType() {
        return databaseConnectionType;
    }

    public void setDatabaseConnectionType(String databaseConnectionType) {
        this.databaseConnectionType = databaseConnectionType;
    }

    public String getDatabaseConnectionMsg() {
        return databaseConnectionMsg;
    }

    public void setDatabaseConnectionMsg(String databaseConnectionMsg) {
        this.databaseConnectionMsg = databaseConnectionMsg;
    }

    DatabaseConnectType(String databaseConnectionType, String databaseConnectionMsg) {
        this.databaseConnectionType = databaseConnectionType;
        this.databaseConnectionMsg = databaseConnectionMsg;
    }

    @Override
    public String toString() {
        return "DatabaseConnectType{" +
                "databaseConnectionType='" + databaseConnectionType + '\'' +
                ", databaseConnectionMsg='" + databaseConnectionMsg + '\'' +
                '}';
    }
    /**
     * 转为数据
     *
     * @return 枚举对象数组
     */
    public static List<Map<String, String>> toList() {
        List<Map<String, String>> list = new ArrayList<>();
        for (DatabaseConnectType item : DatabaseConnectType.values()) {
            Map<String, String> map = new HashMap<>();
            map.put("databaseConnectionType", item.getDatabaseConnectionType());
            map.put("databaseConnectionMsg", item.getDatabaseConnectionMsg());
            list.add(map);
        }
        return list;
    }
}
